{extend name="base"/}
{block name="resources"}
<style>
	.ns-survey-shop{display: flex;align-items: center;padding: 20px 0px 35px 20px!important;flex-wrap: nowrap;box-sizing: border-box;}
	.ns-img-box {width: 80px; height: 80px; line-height: 80px; flex-shrink: 0;}
	.ns-surver-shop-detail{max-width: 1164px;display: flex;flex-wrap: wrap;}
	.ns-survey-shop-name {margin-right: 50px; margin-left: 10px; flex-shrink: 0; font-size: 18px;}
	.ns-surver-shop-detail p {width: 340px;line-height: 40px;padding: 0 10px;}
	
    /* .ns-card-common:first-of-type{margin-top: 0;}
    .layui-card-body{display: flex;justify-content: space-around;padding-bottom: 0 !important;padding-right: 50px !important;padding-left: 50px !important;flex-wrap: wrap;}
    .layui-card-body .content{width: 33.3%;display: flex;flex-direction: column;margin-bottom: 30px;justify-content: center;}
    .layui-card-body .money{font-size: 20px;color: #666;font-weight: bold;margin-top: 10px;max-width: 250px;}
    .layui-card-body .subhead{font-size: 12px;margin-left: 3px;cursor: pointer;} */
</style>

{/block}
{block name='main'}
<div class="layui-card ns-card-common ns-card-brief">
    <div class="layui-card-header">
        <div>
            <span class="ns-card-title">账户概况</span>
        </div>
    </div>
    <div class="layui-card-body">
		
		<div class="layui-card ns-survey-shop">
			<div class="ns-surver-shop-detail">
				<p class="ns-line-hiding"><strong>用户名：</strong><span class="ns-text-color-dark-gray" title="{$user_info.username}">{$user_info.username}</span></p>
				<p class="ns-line-hiding"><strong>联系电话：</strong><span class="ns-text-color-dark-gray" title="{$user_info.mobile}">{if $user_info.mobile == ''} 暂无 {else/} {$user_info.mobile} {/if}</span></p>
				<p class="ns-line-hiding"><strong>已创建店铺数：</strong><span class="ns-text-color-dark-gray" title="{$user_info.created_site_num}">{$user_info.created_site_num}</span></p>
			</div>
		</div>
		
        <!-- <div class="content">
            <p class="title">用户名</p>
            <p class="money">{$user_info.username}</p>
        </div>

        <div class="content">
            <p class="title">联系电话</p>
            <p class="money">
                {if $user_info.mobile == ''} 暂无 {else/} {$user_info.mobile} {/if}
            </p>
        </div>

        <div class="content">
            <p class="title">已创建店铺数</p>
            <p class="money">{$user_info.created_site_num}</p>
        </div> -->

        <div class="content">

        </div>
    </div>
</div>

<div class="layui-card ns-card-common ns-card-brief">
    <div class="layui-card-header">
        <div>
            <span class="ns-card-title">订单管理</span>
        </div>
    </div>
</div>

<!-- 筛选面板 -->
<div class="ns-single-filter-box">
    <div class="layui-form">
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input type="text" name="start_time" id="start_time" placeholder="开始时间" class="layui-input" autocomplete="off" readonly>
                <i class="ns-calendar"></i>
            </div>
            <div class="layui-input-inline end-time">
                <input type="text" name="end_time" id="end_time" placeholder="结束时间" class="layui-input" autocomplete="off" readonly>
                <i class="ns-calendar"></i>
            </div>
            <button class="layui-btn layui-btn-primary" lay-submit lay-filter="search">搜索</button>
        </div>
    </div>
</div>

<div class="layui-tab ns-table-tab" lay-filter="goods_list_tab">
    <ul class="layui-tab-title">
        <li class="layui-this" data-status="">全部</li>
        <li data-status="0">待支付</li>
        <li data-status="1">已支付</li>
    </ul>
    <div class="layui-tab-content">
        <!-- 列表 -->
        <table id="account_list" lay-filter="account_list"></table>
    </div>
</div>

{/block}
{block name="script"}

<!-- 操作 -->
<script type="text/html" id="operation">
    <div class="ns-table-btn">
        <a class="layui-btn" lay-event="detail">详情</a>
    </div>
</script>

<script>
    var start_time,end_time;

    layui.use(['element','laydate','form'], function () {
        var element = layui.element,
            laydate = layui.laydate,
            form = layui.form;
			
		form.render();
		
        //监听Tab切换，以改变地址hash值
        element.on('tab(goods_list_tab)', function () {
            table.reload({
                page: {
                    curr: 1
                },
                where: {
                    'pay_status': this.getAttribute('data-status')
                }
            });
        });
        
        //开始时间
        laydate.render({
            elem: '#start_time' //指定元素
            ,done: function(value, date, endDate){
                start_time = ns.date_to_time(value);
            }
        });
        //结束时间
        laydate.render({
            elem: '#end_time' //指定元素
            ,done: function(value, date, endDate){
                end_time = ns.date_to_time(value);
            }
        });

        /**
         * 搜索功能
         */
        form.on('submit(search)', function (data) {
            data.field.start_time = start_time;
            data.field.end_time = end_time;
            table.reload({
                page: {
                    curr: 1
                },
                where: data.field
            });
            return false;
        });

        /**
         * 监听工具栏操作
         */
        table.tool(function(obj) {
            var data = obj.data;
            switch (obj.event) {
                case 'detail': //编辑
                    location.href = ns.url("admin/sysorder/detail?order_id=" + data.order_id);
                    break;
            }
        });

    });

    table = new Table({
        elem: '#account_list',
        url: ns.url("admin/sysuser/detail"),
        where:{
            sys_uid:{$sys_uid}
        },
        cols: [
            [{
                field: 'order_no',
                title: '订单号',
                width: '12%',
                unresize: 'false'
            }, {
                field: 'out_trade_no',
                title: '外部交易号',
                width: '14%',
                unresize: 'false'
            }, {
                field: 'order_type_name',
                title: '订单类型',
                width: '10%',
                unresize: 'false'
            }, {
                field: 'order_name',
                title: '服务名称',
                width: '10%',
                unresize: 'false'
            }, {
                field: 'amount',
                title: '订单金额',
                width: '10%',
                unresize: 'false',
                templet: function (data) {
                    return '￥' + data.order_money;
                }
            }, {
                field: 'pay_type_name',
                title: '支付方式',
                width: '10%',
                unresize: 'false'
            },{
                field: 'create_time',
                title: '创建时间',
                width: '10%',
                unresize: 'false',
                templet: function (data) {
                    return  ns.time_to_date(data.create_time);
                }
            }, {
                field: 'order_status_name',
                title: '订单状态',
                width: '8%',
                unresize: 'false'
            }, {
                title: '操作',
                toolbar: '#operation',
                unresize: 'false'
            }]
        ]

    });

</script>
{/block}